#{extends '/template/main.html' /}

<script>
    var id='${id}';
    var pageNumber = '${pageNumber}';

    $(function () {
        // 提示
        var msg = '${flash.get("msg")}';
        if(msg) {
            saveSuccess(msg);
        }

        if(id > 0){
            $('#idLoginName').attr('readonly',true);
        }

    });


    function selectDept() {
        layer.open({
            title:"部门选择",
            type: 2,
            area: ['400px', '500px'],
            fixed: true,
            maxmin: false,
            content: '/power/admin/AdminDeptCtrl/popDeptList'
        });
    }

    function callBack(id , name) {
        $('#idAdminDept').val(id);
        $('#idSearchDept').val(name);
        layer.closeAll();
    }

    function saveAdminUser() {
        var dept = $('#idSearchDept').val();
        if(dept == null || dept ==''  ){
            layer.msg('请选择部门!');
            return;
        }
        var merchantId = $('#idMerchant').val();
        if(merchantId == null || merchantId =='' || merchantId <= 0 ){
            layer.msg('请选择场馆!');
            return;
        }

        var userRole = $('#idUserRole').val();
        if(userRole == null || userRole =='' || userRole <= 0 ){
            layer.msg('请选择角色!');
            return;
        }

        $('#idForm').submit();
    }


</script>

<div class="panel panel-default">
    *{<div class="panel-heading">}*
        *{<h3 class="panel-title" onclick="save()">}*
            *{<button id="idBtnSave" class="btn btn-info" onclick="save();">保存</button>}*
        *{</h3>}*
        *{<div class="panel-options">}*
            *{<a href="#" data-toggle="panel" >}*
                *{<span class="collapse-icon">&ndash;</span>}*
                *{<span class="expand-icon">+</span>}*
            *{</a>}*
        *{</div>}*
    *{</div>}*
    <div class="panel-body">

        <form id="idForm" method="POST" role="form" action="/power/admin/AdminUserCtrl/saveAdminUser" enctype="multipart/form-data" class="form-horizontal validate">
            <input id="idAdminUserId" name="adminUser.id" value="${adminUser?.id}" type="hidden">
            <input id="idPageNumber" name="pageNumber" value="${pageNumber}" type="hidden">
            <div class="form-group">
                <label for="idName" class=" col-sm-2 control-label">用户名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control " name="adminUser.name" required id="idName"
                           value="${adminUser?.name}" placeholder="请输入用户名">
                </div>
            </div>
            <div class="form-group">
                <label for="idLoginName" class="col-sm-2 control-label" style="">登录名</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="adminUser.loginName" value="${adminUser?.loginName}"
                           id="idLoginName" placeholder="请输入登录名,一旦保存将不可修改">
                </div>
            </div>
            <div class="form-group">
                <label for="idPhoneNo" class="col-sm-2 control-label" style="">联系电话</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="adminUser.phoneNo" value="${adminUser?.phoneNo}"
                           id="idPhoneNo" placeholder="请输入联系电话">
                </div>
            </div>
            <div class="form-group">
                <label for="idAdminDept" class="col-sm-2 control-label" style="">所属部门</label>
                <div class="col-sm-10">
                    <input type="text" id="idSearchDept" onclick="selectDept()" readonly class="form-control" name="" value="${adminUser?.adminDept?.name}" placeholder="">
                    <input type="hidden" id="idAdminDept" name="adminUser.adminDept.id" value="${adminUser?.adminDept?.id}" id="idAdminDept" placeholder="">
                </div>
            </div>

            <div class="form-group">
                <label for="idMerchant" class="col-sm-2 control-label" style="">所属场馆</label>
                <div class="col-sm-10">
                    <select class="form-control" name="adminUser.merchant.id" id="idMerchant" required placeholder="">
                        <option value="" #{if adminUser?.merchant?.id == null} selected="true"#{/if}>---请选择---</option>
                    #{list merchantList , as:'merchant'}
                        <option value="${merchant.id}" #{if adminUser?.merchant?.id == merchant.id}
                                selected="true" #{/if}>${merchant?.name}</option>
                    #{/list}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="idUserRole" class="col-sm-2 control-label" style="">角色</label>
                <div class="col-sm-10">
                    <select class="form-control" name="roleId" id="idUserRole" placeholder="">
                        <option value="" #{if userRole?.adminRole?.id== null} selected="true"#{/if}>---请选择---</option>
                    #{list roleList , as:'role'}
                        <option value="${role.id}" #{if userRole?.adminRole?.id == role.id} selected="true" #{/if}>${role.name}</option>
                    #{/list}
                    </select>
                </div>

            </div>
            <div class="form-group">
                <label for="btnSave" class=" col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <button type="button" onclick="saveAdminUser()" class="btn btn-info btn-lg" id="btnSave"> 确认保存</button>
                </div>
            </div>
        </form>

    </div>
</div>



<!-- Imported styles on this page -->
<link rel="stylesheet" href="/public/js/uikit/vendor/codemirror/codemirror.css">
<link rel="stylesheet" href="/public/js/uikit/uikit.css">
<link rel="stylesheet" href="/public/js/uikit/css/addons/uikit.almost-flat.addons.min.css">


<script src="/public/jquery/jquery.loadmask.js"></script>
<script src="/public/js/jquery-validate/jquery.validate.min.js"></script>
<script src="/public/js/wysihtml5/lib/js/wysihtml5-0.3.0.js"></script>
<script src="/public/js/wysihtml5/src/bootstrap-wysihtml5.js"></script>
<script src="/public/js/uikit/vendor/codemirror/codemirror.js"></script>
<script src="/public/js/uikit/vendor/marked.js"></script>
<script src="/public/js/uikit/js/uikit.min.js"></script>
<script src="/public/js/uikit/js/addons/htmleditor.min.js"></script>
<script src="/public/js/ckeditor/ckeditor.js"></script>
<script src="/public/js/ulmsale/common.js"></script>
<script src="/public/lib/bootstrap-table/js/bootstrap.min.js"></script>
<script src="/public/lib/bootstrap-table/js/bootstrap-table.min.js"></script>
<script src="/public/lib/bootstrap3-editable/js/bootstrap-editable.js"></script>
<script src="/public/lib/bootstrap-table/js/bootstrap-table-zh-CN.min.js"></script>
<script src="/public/lib/bootstrap-table/js/bootstrap-datetimepicker.min.js"></script>
<script src="/public/lib/bootstrap-table/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/public/lib/bootstrap-table/js/bootstrap-select.min.js"></script>


<script src="/public/lib/layer/js/layer.js"></script>




